﻿using HomagGroup.Base.UI;
using Proxy;
using SharpDX.Direct2D1.Effects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LocalText = Proxy.Properties.Resources;

namespace HomagChina.CCHS.ViewModels
{
    public class BoardReplaceViewModel : NotifyPropertyChangedBase
    {
        ModifyInfoHandle Handle_ModifyInfo;
        CommonHandle Handle_Common;
        public RelayCommand ReplaceCommand { get; }

        private string _Title;
        public string Title
        {
            get => _Title;
            set { _Title = value; OnPropertyChanged(); }
        }

        CCHS_BoardlibraryModel boardlibraryModel = new CCHS_BoardlibraryModel();

        public BoardReplaceViewModel(CCHS_BoardlibraryModel model)
        {
            Title = LocalText.Duplicate_found;
            Handle_ModifyInfo = new ModifyInfoHandle();
            Handle_Common = new CommonHandle();
            boardlibraryModel = model;
            ReplaceCommand = new RelayCommand(ReplaceBoardInformation);
        }

        public void ReplaceBoardInformation()
        {
            var msg = Handle_ModifyInfo.ModifyBoardlibraryInfo(boardlibraryModel) ? LocalText.Congratulations_information_added_successfully
                                                                                  : LocalText.Sorry_information_addition_failed_please_try_again_or_contact_administrator;
            HomagGroup.Base.UI.Windows.MessageBox.Show(msg);
            Handle_Common.CloseDiaLog(Title);
        }
    }
}
